//
//  CXShopFoodListCell.m
//  Meituan_OC
//
//  Created by Tony on 2016/10/6.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CXShopFoodListCell.h"

@implementation CXShopFoodListCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //
//        self.backgroundColor = [UIColor greenColor];
        [self setupUI];
    }
    return self;
}

#pragma markl - setupUI
-(void) setupUI {
    //
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    CGFloat margin = 10;
    CGSize iconSize = CGSizeMake(50, 50);
    CGFloat lineMargin = 3;
    
    // ivwIcon
    UIImageView * ivwIcon = [[UIImageView alloc] init];
    ivwIcon.backgroundColor = [UIColor blueColor];
    
    [self.contentView addSubview:ivwIcon];
    
    [ivwIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.equalTo(self.contentView).mas_offset(margin);
        make.size.mas_offset(iconSize);
    }];
    
    // title
    UILabel * lblTitle = [UILabel cz_labelWithText:@"猪脚饭" fontSize:13 color:[UIColor blackColor]];
    [self.contentView addSubview:lblTitle];
    
    [lblTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ivwIcon);
        make.leading.mas_equalTo(ivwIcon.mas_trailing).mas_offset(margin);
    }];
    
    // lblSale
    UILabel * lblSale = [UILabel cz_labelWithText:@"月售 999" fontSize:11 color:[UIColor cz_colorWithHex:0x7e7e7e]];
    [self.contentView addSubview:lblSale];
    
    [lblSale mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblTitle.mas_bottom).mas_offset(lineMargin);
        make.leading.equalTo(lblTitle);
    }];
    
    // ivwLike(Zan)
    UIImageView * ivwLike = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_food_review_praise"]];
    [self.contentView addSubview:ivwLike];
    
    [ivwLike mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblSale);
        make.leading.equalTo(lblSale.mas_trailing).mas_offset(margin);
    }];
    
    // lblLike
    UILabel * lblLike = [UILabel cz_labelWithText:@"1999" fontSize:11 color:[UIColor cz_colorWithHex:0x7e7e7e]];
    [self.contentView addSubview:lblLike];
    
    [lblLike mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(ivwLike);
        make.leading.equalTo(ivwLike.mas_trailing).mas_offset(margin);
    }];
    
    // lblPrice
    UILabel * lblPrice = [UILabel cz_labelWithText:@"12.9" fontSize:15 color:[UIColor cz_colorWithHex:0xfa2a09]];
    [self.contentView addSubview:lblPrice];
    
    [lblPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lblSale.mas_bottom).mas_offset(lineMargin);
        make.leading.mas_equalTo(lblSale);
    }];
    
    // lblDesc
    UILabel * lblDesc = [UILabel cz_labelWithText:@"猪脚饭太好吃了，都来买吧！" fontSize:11 color:[UIColor cz_colorWithHex:0x7e7e7e]];
    [self.contentView addSubview:lblDesc];
    
    [lblDesc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(ivwIcon.mas_bottom).mas_offset(2 * margin);
        make.leading.equalTo(ivwIcon);
    }];
}




















@end
